package com.tlcx.kfip.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import com.tlcx.kfip.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 主页中筛选数据的view
 * Created by victor on 2016/10/28 14:27.
 * Email:zhuzhaoyang@yuanchuangyun.com
 */

public class KfipFilterView extends LinearLayout{

    private Context mContext;
    private LayoutInflater mInflater;

    @BindView(R.id.rg_kfip_widget_filter)
    RadioGroup radioGroup;

    public KfipFilterView(Context context) {
        super(context);
        init(context);
        setView();
    }

    public KfipFilterView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
        setView();
    }

    public KfipFilterView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
        setView();
    }
    private void init(Context context){
        mContext = context;
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = mInflater.inflate(R.layout.widget_kfip_filter,null,false);
        addView(view);
        ButterKnife.bind(this,view);
    }
    private void setView(){
        RadioButton childFirst = (RadioButton) radioGroup.getChildAt(0);
        childFirst.setChecked(true);
    }
}
